# use third libs
include(FetchContent)

# json
message("Downlaod json from https://gitee.com/bt-server/json.git")
FetchContent_Declare(
  json
  GIT_REPOSITORY https://gitee.com/bt-server/json.git
  SOURCE_DIR ${THIRD_LIB}/json
  GIT_SHALLOW    TRUE # 不拉取完整历史，相当于`git clone --depth=1`
  )

FetchContent_GetProperties(json)
if (NOT json_POPULATED)
  FetchContent_Populate(json)
endif ()

macro(use_json ag_project_name)
  target_compile_definitions(${ag_project_name} PRIVATE USE_LIB_JSON)
  # include json_SOURCE_DIR ==> json
  target_include_directories(${ag_project_name} PRIVATE ${json_SOURCE_DIR}/include)
endmacro(use_json)